#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

int main()
{
    close(1);
    int fd = open("log.txt", O_CREAT | O_WRONLY | O_APPEND, 0666);

    printf("fd: %d\n", fd);
    printf("Hello Linux\n");
    printf("Hello Linux\n");
    printf("Hello Linux\n");
    fflush(stdout);

    const char* msg = "hello write\n";
    write(1, msg, strlen(msg));

    close(1);
    return 0;
}
